package vn.edu.hut.soict.translate.transform.utils;

import simplenlg.framework.LexicalCategory;
import simplenlg.framework.NLGFactory;
import simplenlg.framework.WordElement;
import simplenlg.lexicon.XMLLexicon;
import simplenlg.realiser.english.Realiser;

public class WordTransformUtils {
	protected static XMLLexicon lexicon;
	protected static Realiser realiser;
	protected static NLGFactory phraseFactory;

	static {
		lexicon = new XMLLexicon("res/simplenlg/default-lexicon.xml");
		realiser = new Realiser(lexicon);
		phraseFactory = new NLGFactory(lexicon);
	}

	static public LexicalCategory lexicalCategory(String w) {
		if (w.equalsIgnoreCase("i")) {
			return LexicalCategory.PRONOUN;
		}
		WordElement word = lexicon.getWordFromVariant(w);
		return LexicalCategory.valueOf(word.getCategory().toString());
	}

	static public boolean startsWithAVowel(String word) {
		if (word == null || word.isEmpty()) {
			return false;
		}
		char c = Character.toLowerCase(word.charAt(0));
		if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
			return true;
		}
		return false;
	}
}
